package com.quick.develop.flowable.controller.definition;

import com.quick.develop.flowable.domain.vo.group.BpmGroupUserVO;
import com.quick.develop.framework.common.page.R;
import com.quick.develop.flowable.domain.group.BpmGroupPageReqVO;
import com.quick.develop.flowable.service.definition.IBpmGroupUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author junyuan.liu
 * @description: 
 * @date 2022/5/22 14:39
 */
@Api(tags = "流程管理后台 - 用户组管理")
@RestController
@RequestMapping("/group-user")
@Validated
public class BpmGroupUserController {
    @Resource
    IBpmGroupUserService bpmGroupUserService;

    @GetMapping("/page")
    @ApiOperation(value = "获得组别分页")
    public R<?> getGroupUserPage(BpmGroupPageReqVO pageVO){
        return R.ok(bpmGroupUserService.getGroupUserPage(pageVO));
    }

    @GetMapping("/getGroupList")
    @ApiOperation(value = "获得组别")
    public R<?> getGroupList(BpmGroupUserVO reqVo){
        return R.ok(bpmGroupUserService.getGroupList(reqVo));
    }

    @PostMapping("/create")
    @ApiOperation(value = "新建用户组")
    public R<?> addGroupUser(@RequestBody BpmGroupUserVO reqVo){
        bpmGroupUserService.addGroupUser(reqVo);
        return R.ok();
    }

    @PostMapping("/update")
    @ApiOperation(value = "更新用户组")
    public R<?> updateGroupUser(@RequestBody BpmGroupUserVO reqVo){
        bpmGroupUserService.updateGroupUser(reqVo);
        return R.ok();
    }

    @PostMapping("/delete")
    @ApiOperation(value = "删除用户组")
    public R<?> deleteGroupUser(@RequestBody BpmGroupUserVO reqVo){
        bpmGroupUserService.deleteGroupUser(reqVo);
        return R.ok();
    }


}
